package com.springboot.demo.utils;

import io.swagger.annotations.ApiModelProperty;

/**
 * @author wubc683
 * @desc
 * @date 2021-07-30 10:49
 */
public class Constant {
    public static String SESSION_IMGCODE = "kaptcha";
    public static Long SUPER_ADMIN = 1L;
    public static Long ADMIN = 2L;
    public static Long USER = 3L;
    //    public static String PROFILE_PATH = "c:\\work\\data";
    public static String PROFILE_PATH = "/data/web/profile";
    public static Integer MSG_UNTREATED = 0;
    // 注册账号默认1个月有效期
    public static Integer REGISTER_VALID_MONTH = 1;
    // 用户能创建的设备群最大数量
    public static Integer DEVICE_CLUSTER_MAX_COUNT = 500;
    // 组态连接对应的设备为空
//    public static Long SCENE_DEVICE_IS_EMPTY = -1L;
    public static String WEBSOCKET_PUBLIC_ROOTINGKEY = "/topic/topic.web.public.routingkey";
    public static String WEBSOCKET_PRIVATE_ROOTINGKEY = "/topic/topic.web.private.routingkey";
    //地图缩放尺度最小值
    public static Integer MAP_SCALE_MIN_VALUE = 0;
    //地图缩放尺度最大值
    public static Integer MAP_SCALE_MAX_VALUE = 20;
    //地图经度最小值
    public static Double MAP_LONGITUDE_MIN_VALUE = -200D;
    //地图经度最大值
    public static Double MAP_LONGITUDE_MAX_VALUE = 200D;
    //地图纬度最小值
    public static Double MAP_LATITUDE_MIN_VALUE = -200D;
    //地图纬度最大值
    public static Double MAP_LATITUDE_MAX_VALUE = 200D;
    // 报表对比项最大数量
    public static Integer TABLE_COMPARE_MAX_COUNT = 10;
    // 报表饼图维度最大数量
    public static Integer TABLE_PIE_DIMENSION_MAX_COUNT = 10;
    // 组态未分组的所属sceneGroupId
    public static Long UNGROUPED = 0L;
    // 用户历史记录限制条数,5分钟一条，30天9000条
    public static Integer HISTORY_RECORD_LIMIT_COUNT = 10000;
    // 历史记录存数据时间间隔
    public static Integer SAVE_IN_DB_TIME_INTERVAL = 5 * 60;
    // 报表过滤值最大长度
    public static Integer MAX_FILTER_DATA_LENGTH = 128;

    // 消息类型
    public static class MsgType {
        public static Integer ALARM = 0; //报警
        public static Integer EVENT = 1;//事件
        public static Integer JOB_ORDER = 2;//工单
        public static Integer REPAIRE = 3;//报修
        public static Integer MAINTAIN = 4;//维保
        public static Integer SYSTEM = 5;//系统
    }

    // 消息未读，已读
    public static class Msg {
        public static Integer UNREADED = 0;
        public static Integer READED = 1;
    }

    // 设备群权限
    public static class DevClusterRole {
        public static Integer OWNER = 1;
        public static Integer ADMIN = 2;
        public static Integer USER = 3;
    }

    public static class Auth {
        public static Integer CANCEL = 0;
        public static Integer OK = 1;
    }

    // 设备状态
    public static class DevStatus {
        public static Integer OFFLINE = 0;
        public static Integer ONLINE = 1;
    }

    // 消息状态
    public static class MsgStatus {
        public static Integer UNREPLY = 0;
        public static Integer AGREE = 1;
        public static Integer REFUSED = 2;
    }

    // 组态状态
    public static class SceneStatus {
        public static Integer UNPUBLIC = 0;
        public static Integer PUBLIC = 1;
        public static Integer RUNNING = 2;
        public static Integer OFFLINE = 3;
        public static Integer ALARM = 4;
    }

    // 报警类型
    public static class AlarmType{
        public static Integer ANALOGY = 0;
        public static Integer DISCRETE = 1;
    }

    // 组态配置数据类型长度
    public static class DataTypeLen {
        public static Integer NoType = 0;
        public static Integer Char = 1;
        public static Integer Byte = 2;/* Omron中的byte类型;*/
        public static Integer Int = 3;/*MODBUS的"+/-Int"类型;----Omron中的"+/-DEC"; ----Mitsubishi中的"Int"类型*/
        public static Integer UInt = 4;/*MODBUS的"Int"和"16 Bit Group";----Omron的"DEC"; ----Mitsubishi的"Word"类型*/
        public static Integer Word = 4;
        public static Integer Long = 5;/*MODBUS的"+/-Double";----Omron的"+/-LDEC"; ----Mitsubishi的"DInt"类型*/
        public static Integer DInt = 5;
        public static Integer ULong = 6;/*MODBUS的"Double";----Omron的"LDEC"; ----Mitsubishi的"DWord"类型*/
        public static Integer DWord = 6;
        public static Integer Float = 7;
        public static Integer Real = 7;/*MODBUS的"Float";----Omron的"IEEE"; ----Mitsubishi的"Float"类型*/
        public static Integer Double = 8;
        public static Integer Bool = 9;/*MODBUS的"Bit";----Omron的BIN; ----Mitsubishi的"Bit"类型*/
        public static Integer String = 10;/*MODBUS的"ASCII";----Omron的"ASCII"; ----Mitsubishi的"String"类型*/
        public static Integer StringChar = 10;
        public static Integer DateTime = 11;  /*内部变量的DataTime和S7300的DateTime类型*/
        public static Integer Timer = 12;
        public static Integer BitGroup = 13; /*MODBUS的"16 Bit Group"*/
        public static Integer BitBlock4 = 14; /*Mitsubishi的"4 bit" 类型; 占用一个字节;实际为Byte类型*/
        public static Integer BitBlock8 = 15; /*Mitsubishi的"8 bit" 类型; 占用一个字节;实际为Byte类型*/
        public static Integer BitBlock12 = 16; /*Mitsubishi的"12 bit" 类型; 占用两个字节;实际为UInt类型*/
        public static Integer BitBlock16 = 17; /*Mitsubishi的"16 bit" 类型; 占用两个字节;实际为UInt类型*/
        public static Integer BitBlock20 = 18; /*Mitsubishi的"20 bit" 类型; 占用三个字节;实际为ULong类型*/
        public static Integer BitBlock24 = 19; /*Mitsubishi的"24 bit" 类型; 占用三个字节;实际为ULong类型*/
        public static Integer BitBlock28 = 20; /*Mitsubishi的"28 bit" 类型; 占用三个字节;实际为ULong类型*/
        public static Integer BitBlock32 = 21; /*Mitsubishi的"32 bit" 类型; 占用三个字节;实际为ULong类型*/
        public static Integer PointArea = 22;  /*Mitsubishi added. modbus ppi/mpi hostlink use StringChar. New protocol must use this type not "StringChar"*/
        public static Integer S7300_String = 23; /* 300系列 变长字符串 第一个字节为总长度 第二个字节为字符串实际长度  // 2013-03-18 LIUDIKA*/
        public static Integer S7300_Timer = 24; /* 300系列  2个字节 特殊;作为ULong 4字节处理// 2013-03-18 LIUDIKA*/
        public static Integer S7300_Counter = 25; /* 300系列  2个字节 UInt处理// 2013-03-18 LIUDIKA*/
        public static Integer S7300_Date = 26; /* 300系列  2个字节// 2013-03-18 LIUDIKA*/
        public static Integer S7300_Time = 27; /* 300系列  4个字节; 当作整型数long处理// 2013-03-18 LIUDIKA*/
        public static Integer Day = 28; /* 300系列  4个字节// 2013-03-18 LIUDIKA*/
        public static Integer BRIGHTEK_String = 29;
        public static Integer OPCItem = 30;
        public static Integer KEYENCE_ASCII = 31;
        public static Integer Int21 = 32;
        public static Integer UInt21 = 33;
        public static Integer Long4321 = 34;
        public static Integer Long2143 = 35;
        public static Integer Long3412 = 36;
        public static Integer ULong4321 = 37;
        public static Integer ULong2143 = 38;
        public static Integer ULong3412 = 39;
        public static Integer Real4321 = 40;
        public static Integer Real2143 = 41;
        public static Integer Real3412 = 42;
    }

    // 协议类型
    public static class ProtocolType {
        public static String GATEWAY = "CO-TRUST UDP PPI";
        public static String MODBUS = "Modicon MODBUS";
    }

    // 协议类型值
    public static class ProtocolValue {
        public static Integer GATEWAY = 0;
    }

    // 消息队列
    public static class Rabbitmq {
        public static final String TOPIC_EXCHANGE = "topic.web.exchange";
        public static final String TOPIC_SYSTEM_QUEUE = "topic.web.system.queue";
        public static final String TOPIC_SYSTEM_ROUTINGKEY = "topic.web.system.routingkey";

        public static final String TOPIC_USER_QUEUE = "topic.web.user.queue";
        public static final String TOPIC_USER_ROUTINGKEY = "topic.web.user.routingkey";

        public static final String WEB_TO_CLIENT_EXCHANGE = "web.to.client.exchange";
        public static final String WEB_TO_CLIENT_QUEUE = "web.to.client.queue";
        public static final String WEB_TO_CLIENT_ROUTING_KEY = "web.to.client.routing.key";

        public static final String CLIENT_TO_WEB_EXCHANGE = "client.to.web.exchange";
        public static final String CLIENT_TO_WEB_QUEUE = "client.to.web.queue";
        public static final String CLIENT_TO_WEB_ROUTING_KEY = "client.to.web.routing.key";

    }

    // 组态默认仪表盘
    public static class ScenePanel {
        public static final String MONITOR_PANEL = "监控仪表盘";
    }

    // 仪表盘类型
    public static class PanelType {
        public static final Integer OPERATE_PANEL = 0;
        public static final Integer SCENE_PANEL = 1;
    }

    // 地图聚合类型
    public static class MapDisperseType {
        public static Integer POINT_AGGREGATE = 0; // 点聚合
        public static Integer POINT_DISPERSE = 1; // 点分散
        public static Integer CITY_AGGREGATE = 2; // 城市聚合
    }

    // 地图背景颜色
    public static class MapColor {
        public static Integer WHITE = 0; // 典雅白
        public static Integer BLUE = 1; // 星空蓝
        public static Integer ORANGE = 2; // 油气橙
        public static Integer GREEN = 3; // 能源绿
    }

    // 仪表盘组件类型
    public static class ComponentType {
        public static Integer TABLE = 0;
        public static Integer MAP = 1;
        public static Integer MAP_LINK = 2;
//        public static Integer SCENE_GRAPH = 3;
    }

    // 仪表盘组件位置限制值
    public static class ComponentPos {
        public static Integer LEFT_LIMIT = 0;
        public static Integer RIGHT_LIMIT = 12;
        public static Integer TOP_LIMIT = 0;
        public static Integer DOWN_LIMIT = 32767;
    }

    // 报表类型
    public static class TableType {
        public static Integer INDEX = 1; // 指标卡
        public static Integer TABLE = 2; //列表
        public static Integer LINEGRAPH = 3;//折线图
        public static Integer HISTOGRAM = 4;//柱状图
        public static Integer STACKEDCHART = 5;//堆叠柱状图
        public static Integer BARGRAPH = 6;//条形图
        public static Integer PIECHART = 7;//饼图
    }

    // 报表中数据表类型
    public static class DataTable {
        public static Integer USER = 1; // 用户表
        public static Integer DEVICE = 2; // 设备表
        public static Integer SCENE = 3; // 组态表
        public static Integer HISTORY_DATA = 4; // 历史数据表
        public static Integer HISTORY_ALARM = 5; // 历史报警表
    }

    // 报表中值类型
    public static class TableValueType {
        public static Integer COUNT = 1; // 计数
        public static Integer COUNT_UNIQUE = 2; // 去重计数
        public static Integer AVG = 3; // 平均值
        public static Integer MIN = 4; // 最小值
        public static Integer MAX = 5; // 最大值
        public static Integer SUM = 6; // 求和
        public static Integer FIRST = 7; // 首值
        public static Integer LAST = 8; // 尾值
    }

    // 用户表
    public static class UserTable {
        public static Integer USERNAME = 1;// 用户名
        public static Integer PHONE = 2;//手机号
        public static Integer ROLE = 3;//角色名
        public static Integer IS_PHONE_CHECKED = 4;//电话是否校验
        public static Integer CREATE_DATE_MONTH = 5;//注册时间-月
        public static Integer CREATE_DATE_WEEK = 6;//注册时间-周
        public static Integer CREATE_DATE_DAY = 7;//注册时间-日
        public static Integer CREATE_DATE_HOUR = 8;//注册时间-小时
        public static Integer CREATE_DATE_MINUTE = 9;//注册时间-分钟
    }

    // 设备表
    public static class DeviceTable {
        public static Integer DEVICE_NAME = 1;// 设备名称
        public static Integer MAC_ADDR = 2;//mac地址
        public static Integer DEVICE_CLUSTER = 3;//设备群组
        public static Integer DEVICE_STATUS = 4;//设备状态
        public static Integer PROVINCE = 5;//省
        public static Integer CITY = 6;//市
        public static Integer REGION = 7;//区
        public static Integer CREATE_DATE_MONTH = 8;//注册时间-月
        public static Integer CREATE_DATE_WEEK = 9;//注册时间-周
        public static Integer CREATE_DATE_DAY = 10;//注册时间-日
        public static Integer CREATE_DATE_HOUR = 11;//注册时间-小时
        public static Integer CREATE_DATE_MINUTE = 12;//注册时间-分钟
    }

    // 组态表
    public static class SceneTable {
        public static Integer SCENE_NAME = 1;// 组态名称
        public static Integer SCENE_GROUP = 2;//组态群组
        public static Integer SCENE_STATUS = 3;//组态状态
        public static Integer DEVICE_NAME = 4;// 设备名称
        public static Integer CREATE_DATE_MONTH = 5;//创建时间-月
        public static Integer CREATE_DATE_WEEK = 6;//创建时间-周
        public static Integer CREATE_DATE_DAY = 7;//创建时间-日
        public static Integer CREATE_DATE_HOUR = 8;//创建时间-小时
        public static Integer CREATE_DATE_MINUTE = 9;//创建时间-分钟
    }

    //历史数据表
    public static class HistoryDataTable {
        public static Integer VAR_NAME = 1;// 变量名称
        public static Integer VALUE = 2;// 变量值
        public static Integer DEVICE_NAME = 3;// 设备名称
        public static Integer SCENE_NAME = 4;// 组态名称
        public static Integer PRODUCT_TIME_MONTH = 5;// 产生时间-月
        public static Integer PRODUCT_TIME_WEEK = 6;// 产生时间-周
        public static Integer PRODUCT_TIME_DAY = 7;// 产生时间-日
        public static Integer PRODUCT_TIME_HOUR = 8;// 产生时间-小时
        public static Integer PRODUCT_TIME_MINUTE = 9;// 产生时间-分钟
    }

    //历史报警表
    public static class HistoryAlarmTable {
        public static Integer ALARM_TYPE = 1;// 报警类型
        public static Integer TRIGGER_VAR = 2;// 触发变量
        public static Integer TRIGGER_VALUE = 3;//触发值
        public static Integer ALARM_TEXT = 4;// 报警内容
        public static Integer DEVICE_NAME = 5;// 设备名称
        public static Integer SCENE_NAME = 6;//组态名称
        public static Integer TRIGGER_TIME_MONTH = 7;// 产生时间-月
        public static Integer TRIGGER_TIME_WEEK = 8;// 产生时间-周
        public static Integer TRIGGER_TIME_DAY = 9;// 产生时间-日
        public static Integer TRIGGER_TIME_HOUR = 10;// 产生时间-小时
        public static Integer TRIGGER_TIME_MINUTE = 11;// 产生时间-分钟
    }

    // 报表过滤值类型
    public static class FilterValueType {
        public static Integer NORMAL = 1; // 常规
        public static Integer VALUE = 2; // 值
        public static Integer TIME = 3; // 时间
    }

    // 报表过滤模式
    public static class FilterMode {
        public static Integer EQUAL = 1; // 等于
        public static Integer NOT_EQUAL = 2; // 不等于
        public static Integer LESS_THAN_OR_EQUAL = 3; // 小于等于
        public static Integer MORE_THAN_OR_EQUAL = 4; // 大于等于
        public static Integer LESS_THAN = 5; // 小于
        public static Integer MORE_THAN = 6; // 大于
        public static Integer RANGE = 7; // 选择范围
        public static Integer CONTAIN = 8; // 包含
        public static Integer NOT_CONTAIN = 9; // 不包含
        public static Integer EMPTY = 10; // 为空
        public static Integer NOT_EMPTY = 11; // 不为空
    }

    public static class TableFilterDataType {
        public static Integer STRING_SINGLE = 11; // 单字符串
        public static Integer STRING_MANY = 12; // 多字符串
        public static Integer VALUE_SINGEL = 21; // 单值
        public static Integer VALUE_DOUBLE = 22; // 双值
        public static Integer TIME_SINGLE = 31; // 单个时间
        public static Integer TIME_DOUBLE = 32; // 两个时间
        public static Integer TIME_FIXED = 33; // 时间固定值
        public static Integer HALF_AN_HOUR = 34; // 最近30分钟
        public static Integer HOUR = 35; //最近1小时
        public static Integer THREE_HOUR = 36; // 最近3小时
        public static Integer SIX_HOUR = 37; // 最近6小时
        public static Integer ONE_DAY = 38; // 最近1天
        public static Integer TWO_DAY = 39; // 最近2天
        public static Integer SEVEN_DAY = 40; // 最近7天
        public static Integer ONE_MONTH = 41; // 最近30天
        public static Integer THREE_MONTH = 42; // 最近90天
        public static Integer SIX_MONTH = 43; // 最近6个月
        public static Integer ONE_YEAR = 44; // 最近1年
    }

    // rabbitmq消息码(mico服务器与web服务器交互）
    public static class RBTMQCMD {
        public static Integer START_SCENE = 40000; // 开启组态
        public static Integer STOP_SCENE = 40001; // 关闭组态
        public static Integer SEND_SCENE_DATA = 40002; // 传送组态数据
        public static Integer DELETE_DEVICE = 40100;   // 删除设备
        public static Integer DEVICE_LOGIN = 40101;   // 设备登录
        public static Integer DEVICE_OFFLINE = 40102;   // 设备离线
        public static Integer DEVICE_CLUSTER_TRANSFER_DEVICE = 40103;   // 设备群转移设备
    }

    // mico服务器和web服务器通信回复码
    public static class RBTMQRESP {
        public static Integer OK = 10000; // 成功
        public static Integer ERROR = 10001; // 错误
        public static Integer PARSE_JSON_FAILED = 10002; // 解析json失败
        public static Integer DATABASE_ERROR = 10003; // 数据库错误
        public static Integer START_SCENE_FAILED = 10005; // 开启web组态失败
        public static Integer STOP_SCENE_FAILED = 10006; // 关闭web组态失败
        public static Integer RABBITMQ_CODE_ERROR = 10010; // rabbitmq命令码错误
        public static Integer PARSE_SCENE_DATA_ERROR = 10020; // 解析组态数据错误
    }

    // web服务器与网页交互
    public static class WEBSOCKETCMD {
        public static Integer PARSE_SCENE_DATA = 40002; // 传送组态数据
        public static Integer COMMON_MESSAGE = 50000; // 普通消息
    }

    /**
     * redis中缓存前缀
     */
    public static class CACHE_PREFIX {
        public static String USER = "user::";
        public static String RELATIVEUSER = "relativeUser::";
    }

    public static class DELETE_FLAG {
        public static Integer ACTIVE = 0;
        public static Integer DELETED = 1;
    }

    public static class MENU {
        public static Integer NOT_SELECTED = 0;
        public static Integer SELECTED = 1;
    }

}